package shangji1;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class EmployeeTest {

    @Test
    public void testIntroduce() {
        // 加载 Spring 配置文件
        ApplicationContext context = new ClassPathXmlApplicationContext("employeeContext.xml");

        // 获取员工 Bean 实例
        Employee employee1 = (Employee) context.getBean("employee1");
        Employee employee2 = (Employee) context.getBean("employee2");

        // 调用自我介绍方法
        employee1.introduce();
        employee2.introduce();
    }

    public static void main(String[] args) {
        // 主方法用于直接运行测试
        EmployeeTest test = new EmployeeTest();
        test.testIntroduce();
    }
}